<?php
include("../common.inc.php");
InitGP(array("page","action","date","aid","delids")); //初始化变量全局返回
include("function_common.php");
//初始化对象
include(INC_PATH."/accountcharge.class.php");
$ac=new AccountChargeClass();


$CHARGESTATE=array(0=>"未付款",1=>"已付款");
if(empty($action)){
	InitGP(array("sn","uname")); //初始化变量全局返回
	if(!empty($uname))$wherestr[]="uname like '%{$uname}%'";
	if(!empty($sn))$wherestr[]="sn like '%{$sn}%'";
	if(!empty($wherestr)) $wheresql = implode(' AND ', $wherestr);	//条件汇总
	
	//获取当前页码
	$total=$ac->getcount($wheresql); 							  //总信息数
	$pagesize=15;												  //一页显示信息数
	$page = isset($page) ? max(1, intval($page)) : 1;             //处理页码变量
	$mcffset=($page-1)*$pagesize;   								  //偏移量
	$dataarray=$ac->getdata("$mcffset,$pagesize",$wheresql); //获取团购数据
	
	//包含后台模板文件
	include("tpl/accountcharge_list.htm");
}elseif ($action=="clear" && empty($date)){

	$ac->clear(); 		
	showmsg("清空成功","accountcharge_list.php");//出错！
}elseif ($action=="clear" && !empty($date)){

	$ac->clear($date); 
	showmsg("清空成功","accountcharge_list.php");//出错！
}elseif($action=="downxls"){

	//获取当前页码
	$total=$ac->getcount(); 							  //总信息数
	//$pagesize=15;												  //一页显示信息数
	//$page = isset($page) ? max(1, intval($page)) : 1;             //处理页码变量
	//$offset=($page-1)*$pagesize;   								  //偏移量
	$dataarray=$ac->getdata(); //获取团购数据
	
	$keynames=array(
	"aid"=>"ID",
	"sn"=>"编号",
	"money"=>"充值金额",
	"uid"=>"用户ID",
	"uname"=>"用户名",
	"addtime"=>"添加时间",
	"updatetime"=>"付款时间",
	"state"=>"状态"
	);
	
	down_xls($dataarray, $keynames,'dataxls_'.$total);
}
?>

